﻿using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;
using YNTK.Common.Filter;
using YNTK.System.Entitys.Dto.Permission.User;
using YNTK.System.Entitys.Permission;

namespace YNTK.System.Interfaces.Permission
{
    /// <summary>
    /// 用户服务
    /// 版 本：V1.0.0.0.0
    /// 版 权：云南通科科技有限公司（https://www.yntkkj.com）
    /// 作 者：李仕鹏
    /// 日 期：2022.10.04
    /// </summary>
    public interface ITkUsersService
    {
        /// <summary>
        /// 根据条件获取用户信息
        /// </summary>
        /// <param name="where">条件</param>
        /// <returns></returns>
        Task<UserEntity> GetUserInfoAsync(Expression<Func<UserEntity, bool>> where);

        /// <summary>
        /// 根据用户ID获取用户信息
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns></returns>
        UserEntity GetUserInfoById(string userId);

        /// <summary>
        /// 根据用户ID获取用户信息
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns></returns>
        Task<UserEntity> GetUserInfoByUserId(string userId);

        /// <summary>
        /// 根据用户账户获取用户信息
        /// </summary>
        /// <param name="account">用户账户</param>
        /// <returns></returns>
        Task<UserEntity> GetUserInfoByAccount(string account);

        /// <summary>
        /// 根据账号和密码获取用户信息
        /// </summary>
        /// <param name="account">用户账户</param>
        /// <param name="password">用户密码</param>
        /// <returns></returns>
        Task<UserEntity> GetUserInfoByLoginAsync(string account, string password);

        /// <summary>
        /// 获取用户详细信息
        /// </summary>
        /// <param name="id">用户id</param>
        /// <returns></returns>
        Task<TkResult<TkUserInfoDto>> Get(string id);

        /// <summary>
        /// 根据用户id集合获取用户数据
        /// </summary>
        /// <param name="ids">用户id集合</param>
        /// <returns></returns>
        Task<List<UserEntity>> GetUserListByIds(List<string> ids);

        /// <summary>
        /// 根据条件获取用户数据
        /// </summary>
        /// <param name="where">条件</param>
        /// <returns></returns>
        Task<List<UserEntity>> GetUserListAsync(Expression<Func<UserEntity, bool>> where);

        /// <summary>
        /// 用户被设置为机构主管更新用户所属机构
        /// </summary>
        /// <param name="userId">用户id</param>
        /// <param name="mechanismId">机构id</param>
        /// <returns></returns>
        Task UpdateUserMechanismAsync(string userId, string mechanismId);

        /// <summary>
        /// 批量添加用户
        /// </summary>
        /// <param name="entitys"></param>
        /// <returns></returns>
        Task BatchAddUsersAsync(List<UserEntity> entitys);
    }
}
